const tablemixins = {
  components:{

  },
  props:{
    
  },
  data(){
    return{
        showSearch:true, //是否显示输入框
        tableHeight:'',//表格高度
    }
  },
  mounted(){
    this.handleResize();
    window.addEventListener("resize", this.handleResize);
  },
  methods: {
    
    handleResize(){
        this.$nextTick(() => {
            if(this.showSearch){
                let offsetHeight = this.$refs.queryForm&&this.$refs.queryForm.$el?this.$refs.queryForm.$el.offsetHeight:0;//搜索区域的高度
                this.tableHeight = window.innerHeight - 96 - offsetHeight - 70 - 30; //96为头部加标签栏的高度  70为分页的高度 4
            }else{
                this.tableHeight = window.innerHeight - 96 - 70 - 30; //96为头部加标签栏的高度  70为分页的高度 4
            }
            
        });
    },

    toggleSearch(){
        this.handleResize();
    },
  },
  destroyed() {
    // 全局监听事件在离开页面时要注销
    window.removeEventListener("resize", this.handleResize);
  },
};
export default tablemixins;
